package com.gjzt.business.publish.listener;

import java.util.Date;

import org.activiti.engine.delegate.DelegateExecution;
import org.activiti.engine.delegate.ExecutionListener;

import com.eastdigit.bpm.service.FormFactory;
import com.eastdigit.system.service.SpringServiceFactory;
import com.gjzt.business.publish.inter.PublishBillMapper;
import com.gjzt.business.publish.model.PublishBill;
import com.gjzt.business.utils.Constant;

public class StartListener implements ExecutionListener {

	/**
	 * 
	 */
	private static final long serialVersionUID = 4849521395911709433L;

	@Override
	public void notify(DelegateExecution execution) throws Exception {
		String businessKey = execution.getProcessBusinessKey();
		
		PublishBillMapper publishBillMapper = (PublishBillMapper)SpringServiceFactory.getBean("publishBillMapper");
		
		PublishBill publishBill = new PublishBill();
    	publishBill.setBillId(FormFactory.getBusinessId(businessKey));
    	publishBill.setStatus(Constant.PUBLISH_BILL_STATUS_AUDIT);//启动待审核
    	publishBill.setApplyTime(new Date());
    	publishBillMapper.updateByPrimaryKeySelective(publishBill);

	}
}
